﻿Option Explicit On ' Make sure all items are explicitly declared
Option Strict On ' Be Very Strict about things here!
Partial Public Class Dialog

    ' Public Methods

    ''' <summary>ShowDialog</summary>
    ''' <param name="Title">Title</param>
    ''' <param name="Message">Message</param>
    ''' <remarks>Show Dialog with Title and Message Provided</remarks>
    Public Overloads Sub ShowDialog(ByRef Title As String, ByRef Message As String)
        Me.Title = Title ' Set the Title
        MessageText.Text = Message ' Show the Message
        MyBase.ShowDialog()
    End Sub

    Private Sub Window_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles Me.Closing
        GetType(Window).GetField("_isClosing", Reflection.BindingFlags.Instance Or _
                                 Reflection.BindingFlags.NonPublic).SetValue(Me, False)
        e.Cancel = True
        Me.Hide()
    End Sub

    Private Sub btnClose_Click(ByVal sender As System.Object, _
                               ByVal e As System.Windows.RoutedEventArgs) _
                               Handles btnClose.Click
        Me.Close()
    End Sub

    Private Sub btnCopy_Click(ByVal sender As System.Object, _
                              ByVal e As System.Windows.RoutedEventArgs) _
                              Handles btnCopy.Click
        Clipboard.SetText(MessageText.Text, TextDataFormat.Text)
    End Sub
End Class
